import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

public class ballb extends Ball
{
    public int color = 1;
    boolean band=true;
    World mun;
    mundo w;
    
    public void act() 
    {
        Actor b;
        explosion exp,exp2;
        
        if(band)
        {
            if(Greenfoot.isKeyDown("space"))
            band = false;
        }
        else
        {
        if(barraIntersecting())
        gira();
        
        if(!topIntersecting())
        {
            switch(ballIntersecting())
            {
                case 0:
                    move(4);
                    break;
                case 2:
                case 3:
                    setRotation(-90);
                    
                    break;
                case 1:
                    b = getOneIntersectingObject(ballb.class);
                    mun = getWorld();
                    exp = new explosion();
                    exp2 = new explosion();
                    mun.addObject(exp,getX(),getY());
                    mun.addObject(exp2,b.getX(),b.getY());
                    w = (mundo) super.getWorld();
                    w.aumentaPuntos();
                    
                    mun.removeObject(b);
                    mun.removeObject(this);
                    break;
                case 4:
                    b = getOneIntersectingObject(balln.class);
                    mun = getWorld();
                    exp = new explosion();
                    exp2 = new explosion();
                    mun.addObject(exp,getX(),getY());
                    mun.addObject(exp2,b.getX(),b.getY());
                    w = (mundo) super.getWorld();
                    w.aumentaPuntos();
                    
                    mun.removeObject(b);
                    mun.removeObject(this);
                    break;
                    
            }
        }
        }
        
    }    
}
